//
//  XMEditUserLineView.m
//  XunMi
//
//  Created by MacBook on 2024/2/28.
//  Copyright © 2024 TieZhu. All rights reserved.
//

#import "XMEditUserLineView.h"

@implementation XMEditUserLineView

- (void)awakeFromNib {
    [super awakeFromNib];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap)];
    [_icon addGestureRecognizer:tap];
}

- (void)setShowIcon:(BOOL)showIcon {
    self.leftSpace.constant = showIcon ? 45 : 20;
    self.titleWidth.constant = showIcon ? 130 : 70;
    self.icon.hidden = !showIcon;
}

- (void)setShowGoLa:(BOOL)showGoLa {
    self.goLa.hidden = !showGoLa;
}

- (void)setShowContentLa:(BOOL)showContentLa {
    self.contentLa.hidden = !showContentLa;
    self.actbtn.hidden = !showContentLa;
    self.textField.hidden = showContentLa;
}


- (void)setContentStr:(NSString *)contentStr {
    _contentStr = contentStr;
    if ([contentStr isEqualToString:@"请选择"]) {
        if (@available(iOS 13.0, *)) {
            _contentLa.textColor = [UIColor placeholderTextColor];
        } else {
            // Fallback on earlier versions
            _contentLa.textColor = kHEX(@"#B4B4B6");
        }
    } else {
        _contentLa.textColor = k1F1F1F;
    }
    _contentLa.text = contentStr;
}

- (IBAction)clickAct:(UIButton *)sender {
    if (self.clickBlock) {
        self.clickBlock();
    }
}

- (void)tap {
    if (self.iconBlock) {
        self.iconBlock();
    }
}

@end
